﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

namespace UI
{
    public class UILuckTreasureTemplate : UILuckTemplate
    {
        public UITexture icon;
        public GameObject masked;
        public GameObject actived;

        #region 字典数据
        public Dict.DataModel.TableTreasure dictTreasure;
        protected List<bool> maskeds;
        #endregion

        public override void DictData()
        {
            dictTreasure = Dict.DictDataManager.Instance.tableTreasureDao.GetById(luck.luckData.treaId0);
            maskeds = new List<bool>();
            
        }

        public override void SetIcon()
        {
            MainTexture(icon, dictTreasure.icon);
        }

        protected override void Actived(bool yes0, bool yes1 = false, bool yes2 = false)
        {
            actived.SetActive(yes0);
            maskeds.Add(!yes0);
        }

        protected override void Masked(bool yes0, bool yes1 = false, bool yes2 = false)
        {
            masked.SetActive(yes0);
        }

        protected override void MainTexture(UITexture tex, string iconName)
        {
            tex.GetComponent<TextureKit>().iconType = TextureIcon.TREASURE;
            tex.GetComponent<TextureKit>().textureName = iconName;
        }

        public override void OnClick()
        {
            CommonMethod.ShowDescription(UIItemType.Treasure, luck.luckData.treaId0);
        }

        public override void InitMasked()
        {
            SetMasked(maskeds);
        }
    }
}
